package nyist.media.exception;

import lombok.Data;
import nyist.media.page.ApiResult;

/**
 * 自定义异常处理器
 *
 * @author : dcf
 * @date : 2019/3/11
 */
@Data
public class BusinessException extends RuntimeException {

    /**
     * apiResult
     */
    private ApiResult apiResult;

    /**
     * 异常码
     */
    private Integer code;

    /**
     * 异常信息
     */
    private String errorMsg;

    public BusinessException(ApiResult apiResult, String errorMsg) {
        this.apiResult = apiResult;
        this.errorMsg = errorMsg;
    }

    public BusinessException(ApiResult apiResult) {
        this.apiResult = apiResult;
        this.errorMsg = apiResult.getMsg();
    }

}

